home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / val.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  882 b   |  48 lines

  1. <!--- This example shows Val --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. Val Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  12. <BODY  bgcolor="#FFFFD5">
  13.  
  14. <H3>Val Example</H3>
  15.  
  16.  
  17. <CFIF IsDefined("form.theTestValue")>
  18.  
  19.     <CFIF Val(form.theTestValue) is not 0>
  20.     <H3>The string <CFOUTPUT>#DE(form.theTestValue)#</CFOUTPUT> can be converted to a number:
  21.     <CFOUTPUT>#Val(form.theTestValue)#</CFOUTPUT></H3>
  22.     <CFELSE>
  23.     <H3>The beginning of the string <CFOUTPUT>#DE(form.theTestValue)#</CFOUTPUT> cannot be converted to a number</H3>
  24.  
  25.     </CFIF>
  26.  
  27.  
  28. </CFIF>
  29.  
  30. <FORM ACTION="val.cfm" METHOD="POST">
  31. <P>Enter a string, and discover if
  32. its beginning can be evaluated to a numeric value.
  33.  
  34. <P><INPUT TYPE="Text" NAME="TheTestValue" VALUE="123Boy">
  35.  
  36. <INPUT TYPE="Submit" VALUE="Is the beginning numeric?" NAME="">
  37.  
  38.  
  39. </FORM>
  40.  
  41.  
  42.  
  43.  
  44.  
  45. </BODY>
  46.  
  47. </HTML>       
  48.